/*
 * camera.h
 *
 *  Created on: 2017年7月8日
 *      Author: Case
 */

#ifndef CG_SRC_CAMERA_H_
#define CG_SRC_CAMERA_H_
#include "r_cg_macrodriver.h"

#define	OV7670_DATA_BYTE	 PORT4.PIDR.BYTE  //8个IO口传数据
#define	OV7670_RCLK			 PORT7.PODR.BIT.B1
#define   OV7670_WEN			 PORT7.PODR.BIT.B0
#define   OV7670_WRST			 PORT7.PODR.BIT.B5
#define   OV7670_RRST			 PORT7.PODR.BIT.B4
#define   OV7670_OE				 PORT7.PODR.BIT.B3

#define 	OV7670_FIFO_W_TURE		1
#define	OV7670_FIFO_W_FALSE   0

#define	OV7670_PIX_WIDTH		40
#define	OV7670_PIX_HEIGHT	200

#define	OV7670_YUV422

#ifndef	EPSILON
#define	EPSILON	1e-6
#endif


void	Camera_dice();
uint8_t	Camear_Ostu(void);
void	Camera_Init(void);
void Camera_FIFO_Init(void);
void Camera_Read_FIFO(void);
void Camera_FIFO_RRST(void);
void Camera_FIFO_WRST(void);
void Camera_IIC_WR_Reg(uint8_t Addr,uint8_t Dat);
uint8_t Camera_IIC_RE_Reg(uint8_t Addr);
float  read_average_pixel(void);
//void	Camera_Windows_Set(short sx,short sy,short width,short height);
#endif /* CG_SRC_CAMERA_H_ */
